﻿using SmallBusinessKit.DataAccess.Interfaces;

namespace SmallBusinessKit.DataAccess.Infrastructure
{
    public class UnitOfWork : IUnitOfWork
    {
        #region Properties

        private readonly IDatabaseFactory _databaseFactory;
        private SmallBusinessContext      _dataContext;

        #endregion

        #region Methods

        public UnitOfWork(IDatabaseFactory databaseFactory)
        {
            _databaseFactory =  databaseFactory;
            _dataContext     = _databaseFactory.GetContext();
        }

        public int Commit()
        {   
            return _dataContext.Commit();
        }

        #endregion
    }
}
